package com.demandbreakdown.xiyun.model.dto.user;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

/**
 * 用户注册DTO
 *
 * @author poxz
 */
@Data
@Schema(description = "用户注册DTO")
public class UserRegisterDTO {

    @Schema(description = "用户账号", example = "testuser")
    @NotBlank(message = "该字段不能为空")
    @Size(min = 4, max = 20, message = "用户名长度必须在4-20个字符之间")
    @Pattern(regexp = "^[a-zA-Z0-9_]+$", message = "账号只能包含字母、数字和下划线")
    private String userAccount;

    @Schema(description = "邮箱地址", example = "test@example.com")
    @NotBlank(message = "该字段不能为空")
    @Email(message = "邮箱格式不正确")
    private String email;

    @Schema(description = "用户密码")
    @NotBlank(message = "该字段不能为空")
    @Size(min = 6, max = 20, message = "密码长度必须在6-20个字符之间")
    // TODO: 未来可加强密码校验规则，例如要求包含大写字母、小写字母、数字、特殊字符等
    // @Pattern(regexp = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).+$", message = "密码必须包含至少1个大写字母、1个小写字母和1个数字")
    private String userPassword;

    @Schema(description = "确认密码")
    @NotBlank(message = "该字段不能为空")
    private String checkPassword;

    @Schema(description = "邮箱验证码", example = "123456")
    @NotBlank(message = "邮箱验证码不能为空")
    @Pattern(regexp = "^\\d{6}$", message = "验证码必须为6位数字")
    private String captcha;
}
